﻿﻿﻿@extends('admin.Default')
@section('type')
    <!-- Data Tables -->
    <link href="{{ asset('myadmin/css/plugins/summernote/summernote.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/summernote/summernote-bs3.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/dropzone/basic.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/dropzone/dropzone.css') }}" rel="stylesheet">
@stop
@section('content')
    <style type="text/css">
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
        #l-map{height:300px;width:50%;}
        #r-result{width:100%;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=keXdM18CTQm5jrHeydPispemtrz5Y00v"></script>
    <div class="col-md-8" style="margin-top:50px;margin-left:330px;">
        <form action="/admin/user/userlist/{{ $list->user_id }}" method="post" enctype='multipart/form-data' >
            <input type="hidden" value="{{$list->photo}}" name="photo" >
            <input type='hidden' name='_token' value='{{ csrf_token() }}'>
            <input type='hidden' name='_method' value='PUT'>
        <div class="form-group row">
            <label class="col-sm-2 control-label">账　　号：</label>
            <div class="col-sm-6">
                <input type="text" name="username" class="form-control"  placeholder="{{ $list->username }}" >
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 control-label">密　　码：</label>
            <div class="col-sm-6">
                <input type="password" name="password" class="form-control"  placeholder="请慎重考虑填写">
            </div>
        </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">用户昵称：</label>
                <div class="col-sm-6">
                    <input type="text" name="nickname" value="{{ $list->nickname }}" class="form-control"  placeholder="用户昵称"  >
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">真实姓名：</label>
                <div class="col-sm-6">
                    <input type="text" name="name" value="{{ $list->name }}" class="form-control"  placeholder="真实姓名"  >
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">用户头像：</label>
                <div class="col-sm-6">
                    <img src="{{ url('upload/user/'.$list->photo) }}" id="pic" alt="无" width="120" onclick="demo();" >
                    <input type="file" name="xphoto" id="img" style="display: none">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">用户性别：</label>
                <div class="col-sm-6">
                    　　　　　　
                    <input type="radio" name="sex"   value="m" {{ $list->sex == 'm'?'checked':'' }}  >男　　　　　　
                    <input type="radio" name="sex"   value="w" {{ $list->sex == 'w'?'checked':'' }} >女
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">用户年龄：</label>
                <div class="col-sm-6">
                    <input type="text" name="age" value="{{ $list->age }}" class="form-control"  placeholder="用户年龄"  >
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">用户积分：</label>
                <div class="col-sm-6">
                    <input type="text" name="integral" value="{{ $list->integral }}" class="form-control"  placeholder="用户积分  "  >
                </div>
            </div>
        <button class="btn btn-primary" type="submit"  style="margin-left: 200px;"><strong>提交</strong></button>
        <button class="btn btn-primary" type="reset"><strong>重置</strong></button>
        </form>
    </div>
    @if(session('msg') == 1)
        <script>alert('修改账号失败！');</script>
    @endif
    @if(session('msg') == 2)
        <script>alert('修改密码失败！');</script>
    @endif
    @if(session('msg') == 3)
        <script>alert('修改信息成功！');</script>
    @endif
@stop
@section('script')
    <script type="text/javascript" src="{{ asset('myadmin/js/jquery.min.js') }}"></script><script type="text/javascript"  src="{{ asset('myadmin/js/jquery-2.1.1.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/bootstrap.min.js?v=3.4.0') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/metisMenu/jquery.metisMenu.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/slimscroll/jquery.slimscroll.min.js') }}"></script>
    <!-- iCheck -->
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/iCheck/icheck.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/dropzone/dropzone.js') }}"></script>

    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/jeditable/jquery.jeditable.js') }}"></script>

    <!-- Data Tables -->
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/dataTables/jquery.dataTables.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/dataTables/dataTables.bootstrap.js') }}"></script>
    <script>

        function demo(){
            $("#img").click();  //隐藏了input:file样式后，点击头像就可以本地上传
            $("#img").on("change",function(){
                var objUrl = getObjectURL(this.files[0]) ; //获取图片的路径，该路径不是图片在本地的路径
                if (objUrl) {
                    $("#pic").attr("src", objUrl) ; //将图片路径存入src中，显示出图片
                }
            });
        }


        //建立一個可存取到該file的url
        function getObjectURL(file) {
            var url = null ;
            if (window.createObjectURL!=undefined) { // basic
                url = window.createObjectURL(file) ;
            } else if (window.URL!=undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file) ;
            } else if (window.webkitURL!=undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file) ;
            }
            return url ;
        }

    </script>


@stop
